home *** CD-ROM | disk | FTP | other *** search
- /* randio.c - test random raw disk i/O */
- #include "stdio.h"
-
- long gettime() ;
-
- long randio(dno,nseg,nstart,buffer,nit,offset)
- int dno , nstart , nseg , nit ;
- char *buffer ;
- int offset ;
- {
- int i , nerror ;
- long t ;
-
- nerror =0 ;
- /* do a read in second area to start */
- if( rawread(dno,nseg,nstart+offset,buffer) != 0 )
- nerror = nerror + 1 ;
- t = gettime() ; /* now start timing */
-
- for(i=0 ; i< (nit/2) ; i=i+1)
- { /* read first area */
- if( rawread(dno,nseg,nstart,buffer) != 0 )
- nerror = nerror + 1 ;
- /* read second area */
- if( rawread(dno,nseg,nstart+offset,buffer) != 0 )
- nerror = nerror + 1 ;
- nstart = nstart + nseg ;
- }
- t = gettime() - t ;
- if( t < 0L )
- t = t + 0x1800B0 ;
- if( nerror > 0 )
- printf(" %d errors \n",nerror) ;
- return( t ) ;
- }
-